home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / powerd / source / lib / powerd_lib.lha / PowerD_PPC / RealStr.d < prev    next >
Text File  |  2000-11-20  |  390b  |  21 lines

  1. OPT    PPC,NOEXE
  2.  
  3. PROC RealStr(str:PTR TO CHAR,f:DOUBLE,n=1)(PTR TO CHAR)
  4.     DEFD    d
  5.     DEFL    top,rest,neg=FALSE
  6.     DEF    buf[24]:CHAR        // this is large enough
  7.     IF f<0 THEN neg:=TRUE
  8.     d:=FAbs(f)
  9.     top:=d
  10.     d-=top
  11.     IF d<0
  12.         top--
  13.         d++
  14.     ENDIF
  15.     d*=1000000000
  16.     rest:=d
  17.     IF f<0 THEN top:=-top
  18.     StringF(buf,'\s\d.\z\r\d[9]',IF neg THEN '-' ELSE NIL,Abs(top),rest)
  19.     StrCopy(str,buf,StrLen(buf)-9+n)
  20. ENDPROC str
  21.